<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class BannerConfig extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('banner_config', function (Blueprint $table) {
            $table->id();
            $table->string('name', 50)->comment("广告标题");
            $table->text('desc')->comment("图片位置描述");
            $table->tinyInteger('isDeleted')->default(0)->comment("是否删除，0：已删除，1：未删除");
            $table->integer("createdAt")->comment("创建时间");
            $table->integer("updatedAt")->comment("修改时间");

            // 创建索引
            $table->unique('name');
            $table->collation = 'utf8mb4_general_ci';
        });

        $prefix = config('other.DB_PREFIX','');
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `{$prefix}banner_config` COMMENT = '广告横幅表'"); //表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('banner_config');
    }
}
